<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>判断对象是否为空</title>
</head>
<body>
    

    <script>
        // 
        let obj = {};
        
        function isEmptyObj (obj) {
            for (const key in obj) {
                if (obj.hasOwnProperty(key)) {
                    return false;
                }
            }
            return true;
        }

        console.log(isEmptyObj(obj));
    </script>
</body>
</html>